package com.realone.packman.codec.decoder;

import com.realone.packman.codec.decoder.vo.BmsDecoderDataVo13;
import com.realone.packman.codec.exception.BmsDecoderException;

import java.nio.ByteBuffer;

/**
 * 获取BMS容量 解码
 *
 * @author hugx
 * @create 2018-09-14 13:16
 */
public class BmsDecoder13 extends BmsDecoder<BmsDecoderDataVo13> implements BmsDecoderStrategy {

    public BmsDecoder13(Integer classType) {
        this.classType = classType;
    }

    @Override
    public BmsDecoderDataVo13 decoderBody(ByteBuffer bb) {
        if (bb == null) {
            throw new BmsDecoderException(new NullPointerException());
        }

        BmsDecoderDataVo13 result = new BmsDecoderDataVo13(this.classType);
        result.setCapacity(bb.get());
        return result;
    }




}
